Ext.define('appmod.view.knowledge.content.UploadFileForm', {
    extend: 'Ext.form.Panel',
    alias: [
		'widget.knowledge.content.uploadfileform' ,
		'widget.knowledge-content-uploadfileform'
	],
	region : 'center',
	bodyPadding: 10,
	requires: [
	],
	
	constructor: function (config) {
		
		if (config.fieldStores) {
			this.fieldStores = config.fieldStores;
		}
        this.callParent(arguments);
     },
	
    initComponent: function() {
        var me = this;

		var emptyStore = Ext.create('Ext.data.TreeStore',
		{
			root:
			{
				text: 'Root',
				id: 'root',
				expanded: true,
				children:
				[
				]
			},
			folderSort: false
		});
		
		var dsParentCatelog = emptyStore;
		
		if (me.fieldStores != null) {
			if (me.fieldStores['dsParentCategory']) {
				dsParentCatelog = me.fieldStores['dsParentCategory'];
			}
		}
		
        
        Ext.applyIf(me, {
            items: [
				{
					xtype: 'hiddenfield',
					name: 'id'
				},
				{
					xtype: 'hiddenfield',
					name: 'categoryId'
				},								
                {
					xtype:'combobox',
					fieldLabel:'显示格式',
					name:'type',
					labelWidth:60,
					allowBlank:false,
					editable:false,
			        store: Ext.create('Ext.data.ArrayStore', {
				        fields: ['id', 'name'],
				        data : [
							['lecture','讲 稿'],
							['pic','图 片'],
							['km','综合知识']
						]
				    }),
				    displayField: 'name',
				    valueField: 'id',
					value:'lecture',						
			        typeAhead: true,
			        mode: 'local',
			        triggerAction: 'all',
			        emptyText:'显示分类',
			        selectOnFocus:true,
			        width:235
	        	},
                {
                    xtype: 'filefield',
					labelWidth: 60,
                    fieldLabel: '上传文件',
					name:'uploadFile',
		            buttonText: '',
		            buttonConfig: {
		                iconCls: 'upload-icon'
		            },					
                    anchor: '95%'
                }
            ]
        });
        
        me.callParent(arguments);
    }
});